package com.ldzg.blockwatcher.risk.rules.tron;

import com.ldzg.blockwatcher.notify.enums.NotifySourceEnum;
import com.ldzg.blockwatcher.risk.AbstractRiskRule;
import com.ldzg.blockwatcher.risk.dto.TransactionInfo;
import com.ldzg.blockwatcher.risk.rules.AddressLabelService;
import com.ldzg.blockwatcher.risk.rules.AddressType;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @author 18310740596@163.com
 * @version V1.0.0
 * @since 2025-07-05 11:54:02
 */
@Component
@RequiredArgsConstructor
public class TronCexInteractionRule extends AbstractRiskRule {

    private final AddressLabelService addressLabelService;

    @Override
    protected boolean doCheck(TransactionInfo transactionInfo) {
        if (transactionInfo.getSource() != NotifySourceEnum.TRON) {
            return false;
        }

        return addressLabelService.isAddressType(transactionInfo.getToAddress(), AddressType.EXCHANGE);
    }
}